package com.mentaleye.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.StudentAttendanceRecordDao;
import com.mentaleye.dal.model.StudentAttendanceRecord;
import com.mentaleye.dal.model.StudentAttendanceRecordExample;
import com.mentaleye.dal.service.StudentAttendanceRecordMapper;

@Repository
public class StudentAttendanceRecordDaoImpl implements StudentAttendanceRecordDao {

	@Autowired
	private StudentAttendanceRecordMapper recordMapper;
	
	@Override
	public boolean insertByList(List<StudentAttendanceRecord> recordList) {
		boolean isSuccess=false;
		int result=this.recordMapper.insertByList(recordList);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}

	@Override
	public boolean updateRecord(StudentAttendanceRecord record) {
		boolean isSuccess=false;
		int result=this.recordMapper.updateByPrimaryKey(record);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}
	
	@Override
	public boolean updateRecordBySelective(StudentAttendanceRecord record,StudentAttendanceRecordExample example) {
		boolean isSuccess=false;
		int result=this.recordMapper.updateByExampleSelective(record, example);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}
	
	@Override
	public List<StudentAttendanceRecord> getListByExample(StudentAttendanceRecordExample example) {
		return this.recordMapper.selectByExample(example);
	}
	
	@Override
	public List<Map<String,Object>> getListByMap(Map<String, Object> map) {
		return this.recordMapper.getListByMap(map);
	}

	@Override
	public boolean deleteByExample(StudentAttendanceRecordExample example) {
		boolean isSuccess=false;
		int result=this.recordMapper.deleteByExample(example);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}
}
